package com.sgb.kjwl.view.ui.adapter.home;


import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.BossEntity;
import com.sgb.kjwl.model.entity.supplier3.SupplierRecommendEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

/**
 * @author Administrator
 * by 2021.04.01
 * App首页模块的商品界面中的商家推荐RecycleView的Adapter
 */
public class MerchantRecommendationAdapter extends BaseRecycleAdapter<BossEntity> {

    public MerchantRecommendationAdapter(Context context, List<BossEntity> recommendEntityList) {
        super(context, R.layout.item_merchant_recommend, recommendEntityList);
    }

    @Override
    public void convert(ItemViewHolder holder, BossEntity supplierRecommendEntity) {
        if (TextUtils.isEmpty(supplierRecommendEntity.getSettlingTime())) {
            holder.getView(R.id.authYear).setVisibility(View.GONE);
        } else {
            holder.getView(R.id.authYear).setVisibility(View.VISIBLE);
        }
        holder.setBinding(BR.viewModel, supplierRecommendEntity);
        ImageView imageView = holder.getView(R.id.image_ziying);
        if ("1".equals(supplierRecommendEntity.getSelfSupportTag())) {
            imageView.setVisibility(View.VISIBLE);
        } else {
            imageView.setVisibility(View.GONE);
        }
    }
}
